Skip to content

chore(*): Publish packages with npm provenance - #1891

Merged
LekoArts merged 14 commits into
mainfrom
lekoarts/sdk-530-build-and-deploy-packages-using-the-provenance-flag
Oct 18, 2023
Merged

chore(*): Publish packages with npm provenance#1891
LekoArts merged 14 commits into
mainfrom
lekoarts/sdk-530-build-and-deploy-packages-using-the-provenance-flag

Conversation

@LekoArts

@LekoArts LekoArts commented Oct 16, 2023

Copy link
Copy Markdown
Contributor

Description

This PR enables our packages to be published with npm provenance:
https://docs.npmjs.com/generating-provenance-statements

Since we are using changesets (ref: changesets/changesets#1152) we can other ways of doing that: https://docs.npmjs.com/generating-provenance-statements#using-third-party-package-publishing-tools

I also added the directory to repository (https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository) because provenance needs this: https://docs.npmjs.com/generating-provenance-statements#prerequisites

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/remix
  • @clerk/types
  • @clerk/themes
  • @clerk/localizations
  • @clerk/clerk-expo
  • @clerk/backend
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/fastify
  • @clerk/chrome-extension
  • gatsby-plugin-clerk
  • build/tooling/chore

@LekoArts
LekoArts requested review from a team and dimkl as code owners October 16, 2023 11:56
@changeset-bot

changeset-bot Bot commented Oct 16, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a66fb1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
gatsby-plugin-clerk Patch
@clerk/chrome-extension Patch
@clerk/localizations Patch
@clerk/clerk-js Patch
@clerk/clerk-sdk-node Patch
@clerk/backend Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/shared Patch
@clerk/themes Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/types Patch
@clerk/clerk-expo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread commitlint.config.js
'body-max-line-length': [1, 'always', '150'],
'scope-empty': [2, 'never'],
'scope-enum': [2, 'always', [...getPackageNames(), 'repo', 'release']],
'scope-enum': [2, 'always', [...getPackageNames(), 'repo', 'release', '*']],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to write a commit message that affects everything inside packages, we should use *. So this just adds it as it was missing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was missing, indeed! Great job!

name: Release
if: ${{ github.repository == 'clerkinc/javascript' }}
runs-on: ${{ vars.RUNNER_LARGE }}
permissions:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LekoArts
LekoArts marked this pull request as draft October 16, 2023 14:11
@LekoArts

Copy link
Copy Markdown
Contributor Author

!snapshot

@clerk-cookie

This comment was marked as outdated.

@LekoArts

Copy link
Copy Markdown
Contributor Author

!snapshot

@clerk-cookie

This comment was marked as outdated.

Comment thread .github/workflows/release-prod.yml Outdated
if: ${{ github.repository == 'clerkinc/javascript' }}
runs-on: ${{ vars.RUNNER_LARGE }}
env:
NPM_CONFIG_PROVENANCE: true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 We might be able to add provenance=true to the root .npmrc file in the repo, instead of needing to add the environment variable to each release workflow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LekoArts It looks like that error might have been because the id-token permission wasn't set yet 👀

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LekoArts

Copy link
Copy Markdown
Contributor Author

!snapshot

@clerk-cookie

This comment was marked as outdated.

Comment thread package.json
"yalc:all": "for d in packages/*/; do echo $d; cd $d; yalc push --replace --sig; cd '../../'; done",
"prepare": "husky install",
"changeset": "npx changeset",
"changeset": "changeset",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to use npx, in fact I believe the current setup didn't allow for environment variables (https://brianchildress.co/environment-variables-using-npx/)

@LekoArts
LekoArts marked this pull request as ready for review October 17, 2023 12:18

@nikosdouvlis nikosdouvlis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job with this @LekoArts

@LekoArts
LekoArts added this pull request to the merge queue Oct 18, 2023

@anagstef anagstef left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job here @LekoArts 💯

Merged via the queue into main with commit 3bf6410 Oct 18, 2023
@LekoArts
LekoArts deleted the lekoarts/sdk-530-build-and-deploy-packages-using-the-provenance-flag branch October 18, 2023 10:25
@clerk-cookie clerk-cookie mentioned this pull request Oct 18, 2023
@clerk-cookie

Copy link
Copy Markdown
Collaborator

This PR has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@clerk clerk locked as resolved and limited conversation to collaborators Oct 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants